package huoye.shops.huoye.mine.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.codeideology.android.widget.recycler.RecyclerViewAdapter;

import java.util.HashMap;

import butterknife.BindView;
import huoye.shops.R;
import huoye.shops.huoye.mine.model.PowerList;
import huoye.shops.huoye.mine.model.PowerSelectData;

/**
 * Created by user on 2017/7/24.
 */

public class PowerSelectAdapter extends RecyclerViewAdapter<PowerSelectAdapter.ViewHolder,PowerList> {

    public HashMap<String,PowerList> getValue() {
        return values;
    }

    private HashMap<String,PowerList> values = new HashMap<>();
    public PowerSelectAdapter(Context context) {
        super(context, R.layout.item_power_select);
    }

    @Override
    protected ViewHolder initViewHolder(View view, int i) {
        return new ViewHolder(view);
    }

    @Override
    protected void bindView(final ViewHolder viewHolder, PowerList powerList, int i) {
        final boolean selected = values.containsKey(powerList.getPowerId());
        viewHolder.tv.setText(powerList.getPowerName());
        viewHolder.tv.setSelected(selected);

    }

    public static class ViewHolder extends RecyclerViewAdapter.ViewHolder{
        @BindView(R.id.item_power_select_tv)
        TextView tv;

        ViewHolder(View view) {
            super(view);
        }
    }
}
